package some.other.namespace;

import java.io.File;

import jbitarrays.JBitArrays;
import jbitarrays.api.CrawlerReader;
import jbitarrays.api.InfiniteBitArray;

/**
 * A quick overview of some of the library's features
 */
public class Demo {
	@SuppressWarnings("unused") public static void main(String[] args) throws Exception {
		File f = new File("./demo.bin");
		if (!f.exists()) {
			f.createNewFile();
		}
		InfiniteBitArray array = JBitArrays.fileAsBitArray(f,/*memory-mapped buffer size*/1000 * 1000);
		array.set(/*index*/34483302, true); // set a bit
		array.setN(235904, /*bits to set*/31, /*from lowest bits of*/0xDEADBEEF);

		CrawlerReader reader = JBitArrays.startReading(array, /*from index*/177);
		boolean firstBit = reader.getNext();
		int next17bits = reader.getNextN(17); // returned in lowest bits of int
	}
}
